<%-- 
    Document   : viewAllStudents
    Created on : Sep 24, 2011, 1:10:42 AM
    Author     : clockbuilder
--%>

<%@page import="java.util.Date"%>
<%@page import="java.util.Iterator"%>
<%@page import="java.util.List"%>
<%@page import="org.skuboard.model.Student"%>


<h1>All students in School</h1>

    <!--Table that displays user information -->
    <div id="users_table">
        <table  >
            <thead>
                <tr>
                    <th>User ID</th>
                    <th>First Name</th>
                    <th>Last Name</th>
                    <th>Other Names</th>
<!--                    <th>Address</th>-->
                    <th>Class</th>
<!--                    <th>DOB</th>-->
                    <th>Email</th>
                    <th>Actions</th>
                </tr>
            </thead>
            <tbody>

                <% List<Student> listOfAllStudents = (List<Student>) request.getAttribute("listOfAllStudents");

                    Iterator<Student> it = listOfAllStudents.iterator();

                    String NEW_LINE_SEPARATOR = "<br>";
                    Student studentDTO = null;
                    while (it.hasNext()) {
                        studentDTO = it.next();
                        String studentID = studentDTO.getId();
                        String studentFirstName = studentDTO.getFirstName();
                        String studentLastName = studentDTO.getlastName();
                        String studentOtherNames = studentDTO.getOtherName();
                        String studentAddress = studentDTO.getAddress();
                        String studentClass = studentDTO.getClassLevel();
                        Date studentDOB = studentDTO.getDateOfBirth();
                        String studentEmail = studentDTO.getEMail();
                        //listOfAllStudents = listOfAllStudents + NEW_LINE_SEPARATOR + student.toString();

                %>
                
                <tr style="">
                    <td><%=studentID%></td>
                    <td><%=studentFirstName%></td>
                    <td><%=studentLastName%></td>
                    <td><%=studentOtherNames%></td>
<!--                    <td><%=studentAddress%></td>-->
                    <td><%=studentClass%></td>
<!--                    <td><%=studentDOB%></td>-->
                    <td><%=studentEmail%></td>
                    <td><a href="adminViewStudentProfile?id=<%=studentID%>">View</a>&nbsp;&nbsp;<a href="#">Edit</a>&nbsp;&nbsp;<a href="#">Delete</a>&nbsp;&nbsp;</td>
                </tr>

                <%
                        //end of While loop
                    }

                %>
            </tbody>
        </table>

    
    </div>
